/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */


import java.awt.Graphics2D;
/**
 *
 * @author 86191
 */
public class Rectangle extends Shape {
    private double contactRadius;
    private int height;
    private int width;
    
    public Rectangle(int x, int y, int width,int height) {
        super(x,y);
        this.width = width;
        this.height = height;
        contactRadius = Math.sqrt(width*width/4 + height*height/4);
    }
    
    public int getWidth(){return width;}
    public int getHeight(){return height;}
    
    public double getContactRadius() {return contactRadius;}
    public double getMass() {return width*height;}
    public void draw(Graphics2D g) {

       
        int left = (int) (getX()-width/2);
        int top = (int) (getY()-height/2);
        g.fillRect(left,top, width, height);
        
  
    }
}
